package com.andy.nature.vm

import androidx.lifecycle.MutableLiveData
import com.andy.common.base.BaseViewModel
import com.andy.common.net.HttpRepository
import com.andy.common.model.ResultBean

/**
 * Author:Andy
 * Date:2023/3/20 16:19
 * Description:LoginViewModel
 */
class LoginViewModel : BaseViewModel() {

    val loginData = MutableLiveData<ResultBean>()

    /**
     * 登录
     */
    fun login(tel: String, password: String) {
        launchUI {
            val response = HttpRepository.retrofit.login(tel, password)
            if (response.isSuccessful) {
                loginData.postValue(response.body())
            }
        }
    }
}